package com.dycx.api.controller;

import com.dycx.common.RestResponse;
import com.dycx.common.enums.BizTypeEnum;
import com.dycx.common.enums.EducationEnum;
import com.dycx.common.enums.GenderEnum;
import com.dycx.food.enums.OrderStatusEnum;
import com.dycx.message.enums.MessageTypeEnum;
import com.dycx.payment.enums.PayStatusEnum;
import com.dycx.payment.enums.PayTypeEnum;
import com.dycx.system.enums.AppEnum;
import com.dycx.system.service.ConfigService;
import com.dycx.system.vo.SystemConfig;
import com.dycx.user.enums.*;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@RestController
@RequestMapping
@AllArgsConstructor
public class DictController {

    private ConfigService configService;

    @GetMapping("getDict")
    public RestResponse<Map<String, Object>> getDict() {
        Map<String, Object> result = new HashMap<>();

        Map<String, List<Map<String, Object>>> map = new HashMap<>();
        map.put("education", EducationEnum.getList());
        map.put("gender", GenderEnum.getList());
        map.put("messageType", MessageTypeEnum.getList());
        map.put("setMeal", SetMealEnum.getList());
        map.put("transactionType", TransactionTypeEnum.getList());
        map.put("vipGrade", VipGradeEnum.getList());
        map.put("seatStatus", SeatStatusEnum.getList());
        map.put("saleTicketType", SaleTicketTypeEnum.getList());
        map.put("payType", PayTypeEnum.getList());
        map.put("payStatus", PayStatusEnum.getList());
        map.put("bizType", BizTypeEnum.getList());
        map.put("orderStatusList", OrderStatusEnum.getList());
        map.put("sellerStatus", SellerStatusEnum.getList());
        map.put("vehicleEnergyType", VehicleEnergyEnum.getList());
        map.put("appList", AppEnum.getList());
        result.put("enums", map);

        //获取客服电话
        SystemConfig systemConfig = configService.getSystemConfig();

        SystemConfig sc = new SystemConfig();
        sc.setSiteName(systemConfig.getSiteName());
        sc.setDomain(systemConfig.getDomain());
        sc.setServiceTel(systemConfig.getServiceTel());
        sc.setWxMpQrcode(systemConfig.getWxMpQrcode());
        sc.setWxPrivateQrcode(systemConfig.getWxPrivateQrcode());
        sc.setWxMpAppId(systemConfig.getWxMpAppId());
        sc.setGaodeAk(systemConfig.getGaodeAk());

        result.put("config", sc);

        return RestResponse.success(result);
    }

}
